﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StackRealization
{
    class MyStack
    {
       private ArrayList stackList = new ArrayList();
       private Object popik;

        public void Push(Object some)
        {
            stackList.Add(some);
        }
        
        public Object Pop()
        {
            if (stackList.Count>0)
            {
                popik = stackList[stackList.Count - 1];
                stackList.RemoveAt(stackList.Count - 1);
            }
            else
            {
                popik = "Stack is empty.";
            }
            return popik;
        }

        public void Clear()
        {
            stackList.Clear();
        }

        public void ElementsLeft()
        {
            for (int i = stackList.Count-1; i >= 0; i--)
            {
                Console.WriteLine(stackList[i]);
            }
            Console.WriteLine("The count of the left elements in collection is - {0}.", stackList.Count);
        }
        
        



    }
}
